package com.hn.springcloud.service;

import com.hn.springcloud.pojo.User;
import com.hn.springcloud.vo.ResponseVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * hanni
 * 2019/2/14 0014
 * 16:41
 *
 * provider 注册到eureka服务的名字
 */
@FeignClient(value = "provider",path="/user")
public interface UserService {

    @GetMapping("/b") //这里的URL应该对应生产者的url，
    List<User> findUsers();


    /**
     * Post传递对象
     * @param user
     * @return
     */
    @PostMapping
    public ResponseVo add1(User user);

    @PostMapping("/a")
    public ResponseVo add2(@RequestParam("id") Integer uid, @RequestParam("uname") String name);


    @GetMapping("/b")
    public List<User> get();

    @GetMapping("/c")
    public List<User> get(User u);

    @GetMapping("/d")
    public List<User> get(@RequestParam("id") Integer uid, @RequestParam("uname") String name);

    //占位符传参
    @DeleteMapping("/e/{id}/xxx/{name}")
    public ResponseVo delete(@PathVariable("id") Integer uid, @PathVariable("name") String uname);
}
